#pragma once


#include <IXCheckBox.h>
#include "XButtonImpl.h"

template <class I>
class CXCheckBoxImpl : public CXButtonImpl<I>
{
    typedef CXButtonImpl<I> superclass;

    BEGIN_DEF_SKIN_CLASS(CXCheckBox, superclass, gs_strGuidXSkin)
        IMP_BASIC_INTF(IXCheckBox,    0)
    END_DEF_SKIN_CLASS();

    IMPL_CONTROL_OBJ(CXCheckBoxImpl, superclass, _T("CheckBox"));

public:
    CXCheckBoxImpl();
    virtual ~CXCheckBoxImpl();

public:
    // IXCheckBox
    virtual void    STDMETHODCALLTYPE   put_Check(IN CheckBoxState eCheckState);
    virtual CheckBoxState STDMETHODCALLTYPE   get_Check();

    virtual HRESULT STDMETHODCALLTYPE   put_UnCheckText(IN LPCTSTR szUnCheckText);
    virtual HRESULT STDMETHODCALLTYPE   get_UnCheckText(OUT BSTR* pbstrUnCheckText);

public:
    // IXFrame
    virtual void    STDMETHODCALLTYPE   GetAutoSize(OUT LPSIZE pAutoSize);
    virtual void    STDMETHODCALLTYPE   Draw(XCANVAS xCanvas, const RECT& rcDraw);

public:
    // IXBaseObj
    virtual void STDMETHODCALLTYPE   OnConstruct();
    virtual void STDMETHODCALLTYPE   OnFinalRelease();

protected:
    // CXCheckBoxImpl
    void    ReleaseData();
    void    NeedImage();
    virtual void OnImageChanged();

    // CXFrameImpl
    virtual BOOL    OnClicked(const POINT* pt);

    // CXControlImpl
    virtual HRESULT OnSkinLangChanged();

protected:
    CheckBoxState   m_ChkState;
    XString         m_strOrgText;
    XString         m_strUnCheckText;
    XString         m_strUnCheckTextResId;
};


class CXCheckBox : public CXCheckBoxImpl<IXCheckBox>
{
};
